<?php

use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Admin Routes
|--------------------------------------------------------------------------
|
| Here is where you can register admin routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "admin" middleware group. Now create something great!
|
*/
Route::match(['post','get'],'fileUpload','Controller@FileUploadNew')->name('fileUpload');
Route::group([
    'namespace'=>'Admins',
    'prefix'=>'admin',
], function ($router) {
    $router->get('/',function(){
        return redirect(route('admin.login'));
    });
    #第一个版本
    Route::group([
        'prefix'=>'v1',
    ], function () {
        Route::any('login','LoginController@login')->name('admin.login');
        Route::any('logout','LoginController@logout')->name('admin.login.logout');
        Route::group([
            'middleware' => ['adminLoginAuth'] # 验证用户登录
        ], function (\Illuminate\Routing\Router $router) {
            # 后台主页
            $router->get('/', 'HomeController@homePage')->name('admin.homepage.index');
            $router->get('homePage', function () {
                $url = route('admin.homepage.index');
                return redirect($url);
            })->name('homePage');
            # 控制台首页
            $router->get('index', 'HomeController@default')->name("admin.default");//控制台
            $router->any('default', 'HomeController@index')->name("admin.default.index");

            /*
             |****************************
             | Admins
             | 管理员
             |****************************
             */
            Route::group([
                'namespace'=>'Admin',
                'prefix'=>'account',
            ],function(\Illuminate\Routing\Router $router){
                # 列表
                $router->any('index', 'AdminController@index')->name('v1.account.index');
                # 添加
                $router->any('add', 'AdminController@add')->name('v1.account.add');
                # 编辑
                $router->any('edit/{id?}', 'AdminController@edit')->name('v1.account.edit');
                # 编辑
                $router->any('delete/{id?}', 'AdminController@delete')->name('v1.account.delete');
                # 操作日志
                $router->any('log', 'AdminController@log')->name('v1.account.operate.log');
            });
//            Route::group([
//                'namespace'=>'Admin',
//                'prefix'=>'admin',
//            ], function ($router) {
//                # 账号激活
//                $router->post('activateAccount', 'AdminController@activateAccount')->name('v1.admin.activateAccount');
//            });

            /*
             |-------
             | Banner
             |-------
             */
            Route::group([
                'namespace'=>'Banner',
                'prefix'=>'banner',
            ], function ($router) {
                # 列表
                $router->any('index', 'BannerController@index')->name('v1.admin.banner.index');
                # 创建
                $router->any('add', 'BannerController@add')->name('v1.admin.banner.add');
                # 更新
                $router->any('edit/{id?}', 'BannerController@edit')->name('v1.admin.banner.edit');
                # 修改状态
                $router->any('changeStatus/{id?}', 'BannerController@changeStatus')->name('v1.admin.banner.changeStatus');
                # 删除
                $router->any('delete/{id?}', 'BannerController@delete')->name('v1.admin.banner.delete');
            });


            /*
             |-------
             | 公告
             |-------
             */
            Route::group([
                'namespace'=>'Notice',
                'prefix'=>'notice',
            ], function ($router) {
                # 列表
                $router->any('index', 'NoticeController@index')->name('v1.admin.notice.index');
                # 创建
                $router->any('add', 'NoticeController@add')->name('v1.admin.notice.add');
                # 更新
                $router->any('edit/{id?}', 'NoticeController@edit')->name('v1.admin.notice.edit');
                # 修改状态
                $router->any('changeStatus/{id?}', 'NoticeController@changeStatus')->name('v1.admin.notice.changeStatus');
                # 删除
                $router->any('delete/{id?}', 'NoticeController@delete')->name('v1.admin.notice.delete');
            });


            /*
             |-------
             | 组织
             |-------
             */
            Route::group([
                'namespace'=>'Organization',
                'prefix'=>'organization',
            ], function ($router) {
                # 列表
                $router->any('index', 'OrganizationController@index')->name('v1.admin.organization.index');
                # 创建
                $router->any('add', 'OrganizationController@add')->name('v1.admin.organization.add');
                # 更新
                $router->any('edit/{id?}', 'OrganizationController@edit')->name('v1.admin.organization.edit');
                # 修改状态
                $router->any('changeStatus/{id?}', 'OrganizationController@changeStatus')->name('v1.admin.organization.changeStatus');
                # 删除
                $router->any('delete/{id?}', 'OrganizationController@delete')->name('v1.admin.organization.delete');

                $router->any('changeAdmin/{id?}', 'OrganizationController@changeAdmin')->name('v1.admin.organization.changeAdmin');

                /*
                 |-------
                 | 管理员转让
                 |-------
                */
                Route::group([
                    'prefix'=>'examine',
                ], function ($router) {
                    # 列表
                    $router->any('index/{id?}', 'PostsExamineController@index')->name('v1.admin.organization.examine.index');
//                    # 创建
//                    $router->any('add', 'PostsCommentController@add')->name('v1.admin.post.add');
//                    # UsersController
//                    $router->any('edit/{id?}', 'PostsCommentController@edit')->name('v1.admin.post.edit');
                    # 审核
                    $router->any('auditing/{id?}', 'PostsExamineController@auditing')->name('v1.admin.organization.examine.auditing');
                    # 删除
                    $router->any('delete/{id?}', 'PostsExamineController@delete')->name('v1.admin.organization.examine.delete');
                });

            });
            /*
             |-------
             | 用户
             |-------
             */
            Route::group([
                'namespace'=>'Users',
                'prefix'=>'users',
            ], function ($router) {
                # 列表
                $router->any('index', 'UsersController@index')->name('v1.admin.users.index');
                # 查看
                $router->any('show/{id?}', 'UsersController@show')->name('v1.admin.users.show');
//                # 创建
//                $router->any('create', 'UsersController@create')->name('v1.admin.users.create');
//                # UsersController
//                $router->any('update/{id?}', 'UsersController@update')->name('v1.admin.users.update');
//                # 修改状态
                $router->any('delete', 'UsersController@delete')->name('v1.admin.users.delete');
//                # 修改状态
                $router->any('changeStatus/{id?}', 'UsersController@changeStatus')->name('v1.admin.users.changeStatus');
            });

            /*
             |-------
             | 帖子
             |-------
            */
            Route::group([
                'namespace'=>'Posts',
                'prefix'=>'posts',
            ], function ($router) {
                # 列表
                $router->any('index', 'PostsController@index')->name('v1.admin.post.index');
                # 创建
                $router->any('add', 'PostsController@add')->name('v1.admin.post.add');
                # UsersController
                $router->any('edit/{id?}', 'PostsController@edit')->name('v1.admin.post.edit');
                # 修改状态
                $router->any('changeStatus/{id?}', 'PostsController@changeStatus')->name('v1.admin.post.changeStatus');
                # 删除
                $router->any('delete/{id?}', 'PostsController@delete')->name('v1.admin.post.delete');
                /*
                 |-------
                 | 帖子评论
                 |-------
                */
                Route::group([
                    'prefix'=>'comment',
                ], function ($router) {
                    # 列表
                    $router->any('index/{id?}', 'PostsCommentController@index')->name('v1.admin.post.comment.index');
//                    # 创建
//                    $router->any('add', 'PostsCommentController@add')->name('v1.admin.post.add');
//                    # UsersController
//                    $router->any('edit/{id?}', 'PostsCommentController@edit')->name('v1.admin.post.edit');
                    # 审核
                    $router->any('auditing/{id?}', 'PostsCommentController@auditing')->name('v1.admin.post.comment.auditing');
                    # 删除
                    $router->any('delete/{id?}', 'PostsCommentController@delete')->name('v1.admin.post.comment.delete');
                });
            });

            /*
             |-------
             | 活动
             |-------
            */
            Route::group([
                'namespace'=>'Activity',
                'prefix'=>'activity',
            ], function ($router) {
                # 列表
                $router->any('index', 'ActivityController@index')->name('v1.admin.activity.index');
                # 创建
                $router->any('add', 'ActivityController@add')->name('v1.admin.activity.add');
                # 查看
                $router->any('show/{id?}', 'ActivityController@show')->name('v1.admin.activity.show');
                $router->any('usershow/{id?}', 'ActivityController@usershow')->name('v1.admin.activity.usershow');
                # UsersController
                $router->any('edit/{id?}', 'ActivityController@edit')->name('v1.admin.activity.edit');
                # 活动报名信息
                $router->any('signUpInfo/{id?}', 'ActivityController@signUpInfo')->name('v1.admin.activity.signUpInfo');
                # 删除
                $router->any('delete/{id?}', 'ActivityController@delete')->name('v1.admin.activity.delete');

                $router->any('deleteuser/{id?}', 'ActivityController@deleteuser')->name('v1.admin.activity.deleteuser');
            });

            /*
             |-------
             | 预约管理
             |-------
             */
            Route::group([
                'namespace'=>'Booking',
                'prefix'=>'booking',
            ], function ($router) {
                # 列表
                $router->any('index', 'BookingController@index')->name('v1.admin.booking.index');
                # 创建
                $router->any('create', 'BookingController@create')->name('v1.admin.booking.create');
                # UsersController
                $router->any('update/{id?}', 'BookingController@update')->name('v1.admin.booking.update');
                #
                $router->any('changeStatus', 'BookingController@changeStatus')->name('v1.admin.booking.changeStatus');
                # 修改状态
                $router->any('delete', 'BookingController@delete')->name('v1.admin.booking.delete');
            });

            /*
             |-------
             | 预约管理
             |-------
            */
            Route::group([
                'namespace'=>'Appointment',
                'prefix'=>'appointment',
            ], function ($router) {
                # 列表
                $router->any('index', 'AppointmentController@index')->name('v1.admin.appointment.index');
                # 创建
                $router->any('create', 'AppointmentController@create')->name('v1.admin.appointment.create');
                # UsersController
                $router->any('update/{id?}', 'AppointmentController@update')->name('v1.admin.appointment.update');
                #
                $router->any('changeStatus', 'AppointmentController@changeStatus')->name('v1.admin.appointment.changeStatus');
                # 修改状态
                $router->any('delete', 'AppointmentController@delete')->name('v1.admin.appointment.delete');
                # 预约须知
                $router->any('notice', 'AppointmentController@notice')->name('v1.admin.appointment.notice');
                # 核销
                $router->any('verify', 'AppointmentController@verify')->name('v1.admin.appointment.verify');
                /*
                 |-------
                 | 校门类型
                 |-------
                */
                Route::group([
                    'prefix'=>'schoolGate',
                ], function ($router) {
                    # 列表
                    $router->any('index', 'SchoolGateController@index')->name('v1.admin.appointment.schoolGate.index');
                    # 创建
                    $router->any('add', 'SchoolGateController@add')->name('v1.admin.appointment.schoolGate.add');
                    # UsersController
                    $router->any('edit/{id?}', 'SchoolGateController@edit')->name('v1.admin.appointment.schoolGate.edit');
                    # 修改状态
                    $router->any('changeStatus/{id?}', 'SchoolGateController@changeStatus')->name('v1.admin.appointment.schoolGate.changeStatus');
                    # 删除
                    $router->any('delete/{id?}', 'SchoolGateController@delete')->name('v1.admin.appointment.schoolGate.delete');
                });
            });

            /*
             |-------
             | 客服管理
             |-------
             */
            Route::group([
                'namespace'=>'Customer',
                'prefix'=>'customer',
            ], function ($router) {
                # 客服电话
                $router->any('telephone', 'CustomerController@telephone')->name('v1.admin.customer.telephone');
//                # 列表
//                $router->any('index', 'CustomerController@index')->name('v1.admin.customer.index');
//                # 创建
//                $router->any('create', 'CustomerController@create')->name('v1.admin.customer.create');
//                # UsersController
//                $router->any('update/{id?}', 'CustomerController@update')->name('v1.admin.customer.update');
//                #
//                $router->any('changeStatus', 'CustomerController@changeStatus')->name('v1.admin.customer.changeStatus');
//                # 修改状态
//                $router->any('delete', 'CustomerController@delete')->name('v1.admin.customer.delete');
            });

            /*
             |-------
             | 反馈
             |-------
             */
            Route::group([
                'namespace'=>'Feedback',
                'prefix'=>'feedback',
            ], function ($router) {
                # 列表
                $router->any('index', 'FeedbackController@index')->name('v1.admin.feedback.index');
                # 创建
//                $router->any('add', 'FeedbackController@add')->name('v1.admin.feedback.add');
//                # 更新
//                $router->any('edit/{id?}', 'FeedbackController@edit')->name('v1.admin.feedback.edit');
//                # 修改状态
//                $router->any('changeStatus/{id?}', 'FeedbackController@changeStatus')->name('v1.admin.feedback.changeStatus');
                # 删除
                $router->any('delete/{id?}', 'FeedbackController@delete')->name('v1.admin.feedback.delete');
            });
        });
    });
});
Route::any('common','Controller@common');

